IF FIL_LOCK(0)
   APPEN BLANK
ENDIF
IF REC_LOCK(0)
   REPL PAT_FILCOD WITH KDPAT,PAT_CODTYP WITH TPPAT,PAT_M_INIT WITH MNMPAT
   REPL PAT_NAME WITH NMPAT,PAT_F_NAME WITH FNMPAT,VISIT_NBER WITH NOBER,DATE_VISIT WITH DATE()
   REPL PHAR_NBER WITH STR(NDISP,2),PHAR_CODE WITH DISPk,PHAR_HL WITH HPRIC,PHAR_PAY WITH PPRIC
   REPL PHAR_NAME WITH NMDS,PHAR_TYPE WITH TPDS,PHAR_QANT WITH QANT,PHAR_X WITH DQNT,PHAR_UNIT WITH UNNI
   REPL HEALTHLINE WITH HLRES,SALE_PRICE WITH UNPS,SELL_UNIT WITH SEUN,phar_price with totpr
   REPL CASH_NAME WITH USERNM
ENDIF
UNLOCK
